
using System;
using Gtk;

namespace Banshee.Plugins.iTunesImporter
{
	
	internal class iTunesSettings : Gtk.Dialog
	{
		private Button ImportButton;
		private CheckButton RatingsCheckbox, StatsCheckbox, PlaylistsCheckbox,
			SPlaylistsCheckbox;
		
		public bool Ratings	{
			get { return RatingsCheckbox.Active; }
		}
		public bool Stats {
			get { return StatsCheckbox.Active; }
		}
		public bool Playlists {
			get { return PlaylistsCheckbox.Active; }
		}
		public bool SPlaylists {
			get { return SPlaylistsCheckbox.Active; }
		}
		
		private void UiLogicCheck()
		{
			if(!Ratings && !Stats && !Playlists && !SPlaylists) {
				ImportButton.Sensitive = false;
			} else {
				ImportButton.Sensitive = true;
			}
		}
		
		public iTunesSettings()
		{
			Stetic.Gui.Build(this, typeof(Banshee.Plugins.iTunesImporter.iTunesSettings));
		}

		protected virtual void OnImport(object sender, System.EventArgs e)
		{
			Respond(1);
		}

		protected virtual void OnCancel(object sender, System.EventArgs e)
		{
			Respond(0);
		}

		protected virtual void OnRatings(object sender, System.EventArgs e)
		{
			UiLogicCheck();
		}

		protected virtual void OnStats(object sender, System.EventArgs e)
		{
			UiLogicCheck();
		}

		protected virtual void OnPlaylists(object sender, System.EventArgs e)
		{
			UiLogicCheck();
		}

		protected virtual void OnSPlaylists(object sender, System.EventArgs e)
		{
			UiLogicCheck();
		}
	}
}
